import redis
from datetime import datetime
import sys
import time
        
if __name__ == '__main__':
    pref = 'zero'
    if len(sys.argv) >1:
        pref = sys.argv[1]
        
    redis_svr =  'localhost'
    r = redis.Redis(redis_svr)
    r.flushall()
    pipe = r.pipeline()
    
    while (1):
        start_time = datetime.now()
        for i in range(1,20000):
            key = pref + ('_%d' % i)
            pipe.set(i, i*2)
    
        pipe.execute()
        print 'end', datetime.now()-start_time
        
        #time.sleep(1)